import { defHttp } from "@/utils/http";

// ERP 资产类型 VO
export interface PropertyTypeVO {
	id: number; // ID
	parentId: number; // 父级ID
	name: string; // 资产类型名称/描述
	sqNumb: number; // 顺序
	status: string; // 状态
}

// ERP 资产类型 API
export const PropertyTypeApi = {
	// 查询资产类型分页
	getPropertyTypePage: async (params: any) => {
		return await defHttp.get({ url: `/whs/assets/page`, params });
	},

	// 查询资产类型详情
	getPropertyType: async (id: number) => {
		return await defHttp.get({ url: `/whs/assets/get?id=` + id });
	},

	// 新增资产类型
	createPropertyType: async (data: PropertyTypeVO) => {
		return await defHttp.post({ url: `/whs/assets/create`, data });
	},

	// 修改资产类型
	updatePropertyType: async (data: PropertyTypeVO) => {
		return await defHttp.put({ url: `/whs/assets/update`, data });
	},

	// 删除资产类型
	deletePropertyType: async (id: number) => {
		return await defHttp.delete({
			url: `/whs/assets/delete?id=` + id
		});
	},

	// 导出资产类型 Excel
	exportPropertyType: async (params: any) => {
		return await defHttp.download({ url: `/whs/assets/export-excel`, params });
	}
};
